import { http } from "@/utils/http";
import type {
  PageVoProjectDemandListVo,
  ProjectDemandActivityLogVo,
  ProjectDemandChildrenListVo,
  ProjectDemandCreateCmd,
  ProjectDemandDetailsVo,
  ProjectDemandUpdateCmd
} from "@/api/models";

export const createDemand = (demand: ProjectDemandCreateCmd) => {
  return http.post("/project/demand/create", {
    data: demand
  });
};
export const taskDemand = (query: {
  projectId?: string;
  keyword?: string;
  size: number;
  current: number;
  status?: number[];
  all?: boolean;
}) => {
  return http.get<PageVoProjectDemandListVo>("/project/demand/task", {
    params: query
  });
};
export const demandList = (query: {
  projectId: string;
  keyword?: string;
  size: number;
  current: number;
  status?: number[];
}) => {
  return http.get("/project/demand/demand", {
    params: query
    // paramsSerializer:
  });
};
export const demandLog = (demandId: string) => {
  return http.get<ProjectDemandActivityLogVo[]>("/project/demand/log", {
    params: { demandId }
  });
};
export const demandDetails = (demandId: string) => {
  return http.get<ProjectDemandDetailsVo>("/project/demand/details", {
    params: { demandId }
  });
};
export const demandChildren = (demandId: string) => {
  return http.get<ProjectDemandChildrenListVo>("/project/demand/children", {
    params: { demandId }
  });
};
export const deleteDemand = (demandId: string) => {
  return http.delete("/project/demand/delete", {
    params: { demandId }
  });
};
export const updateDemand = (demand: ProjectDemandUpdateCmd) => {
  return http.put("/project/demand/update", {
    data: demand
  });
};
